<template>
  <div class="wrapper">
    <div class="header">试题篮</div>
    <el-scrollbar class="scroll">
      <QuestionItem2
        v-for="(question, index) in questionList"
        :key="index"
        :index="index"
        :id="question.id"
        :content="question.content"
        :options="question.options"
        :answer="question.answer"
        :desc="question.desc"
        :display-desc="displayDesc"
        :knowledge="question.knowledge"
        :selected="question.selected"
      />
    </el-scrollbar>
    <div class="opts">
      <el-text class="mx-1 delete" size="large" type="danger">
        <el-icon style="margin-right: 5px"><Delete /></el-icon>清空试题</el-text
      >
      <el-button class="btn" color="#43b883" :dark="true">预览试卷</el-button>
    </div>
  </div>
</template>

<script setup>
import QuestionItem2 from './QuestionItem2.vue'
import { ref } from 'vue'

defineProps(['questionList'])

const displayDesc = ref(false)
</script>

<style lang="scss" scoped>
.wrapper {
  padding: 20px;
  position: relative;

  .header {
    border-bottom: 1px solid #ccc;
    height: 50px;
    line-height: 50px;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
  }

  .scroll {
    height: calc(100% - 80px);
    box-sizing: border-box;
    padding-bottom: 60px;
  }

  .opts {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding: 0 20px;
    background-color: #fff;

    .delete:hover {
      cursor: pointer;
      color: #f89898;
    }

    .btn {
      width: 30%;
      font-size: 18px;
      color: #fff;
      height: 50px;
      box-sizing: border-box;
    }
  }
}
</style>
